unit fmMessageBox;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, AdvSmoothMessageDialog;

type
  TMessageBoxForm = class(TForm)
    SMConfirmDialog: TAdvSmoothMessageDialog;
    SMErrorDialog: TAdvSmoothMessageDialog;
    SMInfoDialog: TAdvSmoothMessageDialog;
    SMWarningDialog: TAdvSmoothMessageDialog;
  private
    { Private declarations }
  public
    { Public declarations }
    class function ShowConfirm(AOwner: TComponent; TitleText, ConfirmText: string): boolean;
    class procedure ShowError(AOwner: TComponent; TitleText, ErrorText: string);
    class procedure ShowInfo(AOwner: TComponent; TitleText, InfoText: string);
    class procedure ShowWarning(AOwner: TComponent; TitleText, WarningText: string);
  end;

var
  MBF: TMessageBoxForm;

implementation

{$R *.dfm}

{ TMessageBoxForm }

class function TMessageBoxForm.ShowConfirm(AOwner: TComponent; TitleText, ConfirmText: string): boolean;
begin
  with Create(AOwner) do
  try
    Show;
    SMConfirmDialog.Caption := '    ' + TitleText;
    SMConfirmDialog.HTMLText.Text := ConfirmText;
    Result := SMConfirmDialog.ExecuteDialog = mrYes;
  finally
    Free;
  end;
end;

class procedure TMessageBoxForm.ShowError(AOwner: TComponent; TitleText,
  ErrorText: string);
begin
  with Create(AOwner) do
  try
    Show;
    SMErrorDialog.Caption := '    ' + TitleText;
    SMErrorDialog.HTMLText.Text := ErrorText;
    SMErrorDialog.ExecuteDialog;
  finally
    Free;
  end;
end;

class procedure TMessageBoxForm.ShowInfo(AOwner: TComponent; TitleText,
  InfoText: string);
begin
  with Create(AOwner) do
  try
    Show;
    SMInfoDialog.Caption := '    ' + TitleText;
    SMInfoDialog.HTMLText.Text := InfoText;
    SMInfoDialog.ExecuteDialog;
  finally
    Free;
  end;
end;

class procedure TMessageBoxForm.ShowWarning(AOwner: TComponent; TitleText,
  WarningText: string);
begin
  with Create(AOwner) do
  try
    Show;
    SMWarningDialog.Caption := '    ' + TitleText;
    SMWarningDialog.HTMLText.Text := WarningText;
    SMWarningDialog.ExecuteDialog;
  finally
    Free;
  end;
end;

end.
